package com.example.mapper;

import com.example.pojo.Group;
import com.example.pojo.Teacher;
import com.example.pojo.TeachingClass;
import com.example.pojo.TeachingStudentInClass;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClassMapper {
    //教学班创建并关联活动
    @Insert("insert into t_manager_class (name,created_time,class_desc,activity_id,teacher_id)" +
            "values (#{name},#{createdTime},#{classDesc},#{activityId},#{teacherId})")
    void createTeachingClass(TeachingClass teachingClass);

    //教学班编辑
    void updateTeachingClass(TeachingClass teachingClass);

    //分配教师
    @Update("update t_manager_class set teacher_id = #{id} where name = #{name}")
    void assignTeacherToTeachingClass(Integer id,String name);

    //教学班查询
    @Select("select * from t_manager_class where activity_id = (select id from t_manager_activity where name = #{name});")
    TeachingClass queryByName(String name);

    //关联学生
    void assignStudent(TeachingStudentInClass teachingStudentInClass);

    //生成班级小组
    @Insert("insert into t_manager_group (group_name,class_id) values (#{groupName},#{classId})")
    void createGroup(Group group);
}
